<div onclick="return hide()" id="transparentDiv" style='<?php if (!isset($_POST['islogin'])) echo "display:none" ?>' > 
</div>
<div id="popupDiv" style='<?php if (!isset($_POST['islogin'])) echo "display:none" ?>'>
	<h1 id="logo-login"> Tyvo Ranger </h1><br/>
	<form name="login" action="index.php" method="post">
		Username <span id="space">..</span><input name="username" type="text" /><br/>
		Password <span id="space">_.</span><input name="password" type="password" /><br/><br/>
		<input name="islogin" type="text" value="1" style="display : none" />
		<input id="submit-login" type="submit" value="Log in" />
		
		<?php 
			if (isset($_POST['islogin'])) {
				$islogin = ((isset($_POST['login']))? $_POST['login'] : "undefined"); 
				$username = ((isset($_POST['username']))? $_POST['username'] : "undefined");
				$password = ((isset($_POST['password']))? $_POST['password'] : "undefined");
				
				$mysql_db = "progin_171_13509027";
				$mysql_user = "progin";
				$mysql_pass = "progin";
				$mysql_link = mysql_connect("localhost", $mysql_user, $mysql_pass);
				mysql_select_db($mysql_db, $mysql_link);
				
				$result = mysql_query("SELECT password FROM user WHERE username='$username'") or die(mysql_error());
				$realpass=mysql_fetch_array($result);
				if ($password == $realpass['password']) {
					session_start();
					$_SESSION['user'] = $username;
					header("Location:?page=profil&p=1");
				} else {
					echo "gagal..";
				}
			}
		?>
	</form>
		<input id="but-cancel" type="submit" onclick="return hide()" />
</div>
